{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "63b244c5",
   "metadata": {},
   "source": [
    "# Listen to augmented audio samples"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4633762d",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "import os\n",
    "import sys\n",
    "os.chdir('../..')\n",
    "sys.path.insert(1, os.path.join(sys.path[0], '../..'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "740315f1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sslsv.datasets.DataAugmentation import DataAugmentation, DataAugmentationConfig"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8bafcc2b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import soundfile as sf\n",
    "from pathlib import Path\n",
    "import IPython.display as ipd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "06f4f959",
   "metadata": {},
   "outputs": [],
   "source": [
    "augmentation = DataAugmentation(DataAugmentationConfig(), Path('data/'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cde836df",
   "metadata": {},
   "outputs": [],
   "source": [
    "sample_path = 'data/voxceleb1/id10270/5r0dWxy17C8/00001.wav'\n",
    "\n",
    "data, sr = sf.read(sample_path)\n",
    "data = data.reshape((1, -1)).astype(np.float32)\n",
    "\n",
    "ipd.display(ipd.Audio(data, rate=sr))\n",
    "ipd.display(ipd.Audio(augmentation(data), rate=sr))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
